#pragma once
#include "BaseInc.h"

namespace Theme
{

#define BORDER_COLOR _T("#FFEFEFEF")
#define BACK_COLOR _T("#FF343434")
#define TEXT_COLOR _T("#FF343434")

	extern tstring BUTTON_BORDER_COLOR;
	extern tstring BUTTON_BACK_COLOR;
	extern tstring BUTTON_FORE_COLOR;
	extern tstring BUTTON_HOVER_COLOR;
	extern tstring BUTTON_PRESS_COLOR;
	extern tstring LABEL_BACK_COLOR;
	extern tstring LABEL_TEXT_COLOR;
	extern tstring PROGRESS_CONTAINER_COLOR;
	extern tstring PROGRESS_CONTAINER_BORDER_COLOR;
	extern tstring PROGRESS_THUMB_COLOR;
	extern tstring PROGRESS_THUMB_BORDER_COLOR;
	extern tstring PROGRESS_THUMB_HOVER_COLOR;
	extern tstring RELATIVE_BOX_BACK_COLOR;
	extern tstring RELATIVE_BOX_BORDER_COLOR;

	class ITheme {
	public:
	
		virtual tstring	GetBackColor() = 0;
		virtual tstring	GetForeColor() = 0;
		virtual tstring	GetHoverColor() = 0;
		virtual tstring	GetBorderColor() = 0;
		virtual	tstring	GetPressColor() = 0;
		virtual tstring	GetThumbColor() = 0;
		virtual tstring	GetThumbBorderColor() = 0;
		virtual tstring	GetThumbHoverColor() = 0;
	};
	class DefaultTheme : public ITheme {
	public:
		static ITheme* GetInstance()
		{
			static DefaultTheme inst;
			return &inst;
		}

		DefaultTheme() {}
		bool ParseFromXml(const char* file);
		tstring	GetBackColor() { return BUTTON_BACK_COLOR; }
		tstring	GetForeColor() { return BUTTON_FORE_COLOR; }
		tstring	GetHoverColor() { return BUTTON_HOVER_COLOR; }
		tstring	GetBorderColor() { return BUTTON_BORDER_COLOR; }
		tstring	GetPressColor() { return BUTTON_PRESS_COLOR; }
		tstring	GetThumbColor() { return PROGRESS_THUMB_COLOR; }
		tstring	GetThumbBorderColor() { return PROGRESS_THUMB_BORDER_COLOR; }
		tstring	GetThumbHoverColor() { return PROGRESS_THUMB_HOVER_COLOR; }
	};

	class CustomTheme : public ITheme {
	public:
		static ITheme* GetInstance()
		{
			static CustomTheme inst;
			return &inst;
		}

		CustomTheme() { ParseFromXml("theme.xml"); }
		bool ParseFromXml(const char* file);
		tstring	GetBackColor() {  return mp_clr["BACK_COLOR"]; }
		tstring	GetForeColor() { return mp_clr["FORE_COLOR"]; }
		tstring	GetHoverColor() { return mp_clr["HOVER_COLOR"]; }
		tstring	GetPressColor() { return mp_clr["PRESS_COLOR"]; }
		tstring	GetBorderColor() { return mp_clr["BORDER_COLOR"]; }
		tstring	GetThumbColor() { return mp_clr["THUMB_COLOR"];}
		tstring	GetThumbBorderColor() { return mp_clr["THUMB_BORDER_COLOR"]; }
		tstring	GetThumbHoverColor() { return mp_clr["THUMB_HOVER_COLOR"]; }
	private:
		bool SetColor(std::string key, TiXmlElement* clr);
		std::map<std::string, tstring>   mp_clr;
	};
};


